<!--夫妻加减名-->
<template>
  <div class="ehb all">
    <ehb-header :service-name="jdxx.ywlxmc" :area="jdxx.jdmc"></ehb-header>
    <ehb-multi-process :current.sync="current" :steps="steps" :is-submit="isSubmit" @nextClick="nextClick"
                       @complete="complete">
      <div v-if="current==1" v-html="text.workGuide"></div>
      <div v-if="current==2" v-html="text.readingNote"></div>
      <div v-if="current==3">
        <form class="form">
          <div class="formItem">
            <div class="label">办理网点选择<span style="color: red">&nbsp;*</span></div>
            <span class="input" v-bind:class="addBlwdStep.isGray?'isGray':''" @click="getBlwd()"><span
              style="width: 95%;">{{addBlwdStep.blwd.name}}</span><img src="../../assets/img/pulldown.png"></span>
          </div>
        </form>
      </div>
      <div v-if="current==4">
        <form class="form">
          <div class="formItem">
            <span style="font-size: 0.30rem;">证书类型&nbsp;&nbsp;</span>

            <RadioGroup v-model="addInfoStep.zslx">
              <Radio label="1" style="font-size: 0.30rem;">不动产权证号</Radio>
              <Radio label="2" style="font-size: 0.30rem;">旧证书号</Radio>
            </RadioGroup>
          </div>
          <div class="formItem" v-if="addInfoStep.zslx=='1'">

            <div class="divInput"><span>鄂(<span
              style="width: 3.30rem;height: 0.86rem;padding-left: 0.2rem;align-items: center;"
              @click="getDate()">{{addInfoStep.bdch.date}}<img
              style="width: 0.6rem;height: 0.3rem;transform: rotate(90deg);color: black;"
              src="../../assets/img/arrow.svg"/>)</span></span>
              <ehb-input-clear inputType="text" textName="城市" placeholder="请输入XX市/县" @inputChanged="inputValue($event)"
                               @clearInput="clearInput" @blur="blur()" :current-value.sync="addInfoStep.bdch.city"
                               className="city"></ehb-input-clear>
            </div>
            <div class="divInput"><span>不动产权第</span>
              <ehb-input-clear inputType="text" textName="序号" placeholder="0000001" @inputChanged="inputValue($event)"
                               @clearInput="clearInput" @blur="blur()" :current-value.sync="addInfoStep.bdch.xh"
                               className="city"></ehb-input-clear>
              <span>号</span></div>

          </div>
          <div class="formItem" v-if="addInfoStep.zslx=='2'">
            <ehb-input-clear inputType="text" textName="证号" placeholder="请输入不动产权证号" @inputChanged="inputValue($event)"
                             @clearInput="clearInput" @blur="blur()"
                             className="input" :current-value.sync="addInfoStep.bdcqzh"></ehb-input-clear>
          </div>

        </form>
      </div>
      <div v-if="current==5">
        <div v-if="addYwrStep.option.continueAdd">
          <div v-for="(ywr,i) in addYwrStep.ywrList" @touchstart="touchYwrStart(i)" @touchmove="touchYwrMove"
               @touchend="touchYwrEnd" style="user-select:none;">

            <div class="normal-content">
              <div class="normal-row"><span class="col1">名称：</span><span class="col2">{{ywr.mc}}</span></div>
              <div class="normal-row"><span class="col1">证件号：</span><span class="col2">{{ywr.zjh}}</span></div>

            </div>
          </div>
          <div style="color:red;width: 100%;text-align: center;" v-if="addYwrStep.ywrList.length>0">
            (长按可删除卖方)
          </div>
          <form class="form">
            <div class="formItem">
              <button type="button" class="submit" @click="continueAddYwr">继续添加</button>
            </div>
          </form>
        </div>
        <form class="form" v-if="addYwrStep.option.addYwr">
          <div class="formItem">
            <div class="label">名称<span style="color: red">&nbsp;*</span></div>
            <ehb-input-clear inputType="text" textName="名称" placeholder="请输入名称" @inputChanged="inputValue($event)"
                             @clearInput="clearInput" @blur="blur()" :current-value.sync="addYwrStep.ywr.mc"
                             className="input"></ehb-input-clear>
          </div>

          <div class="formItem">
            <div class="label">证件号码<span style="color: red">&nbsp;*</span></div>
            <ehb-input-clear inputType="text" textName="证件号码" placeholder="请输入证件号码" @inputChanged="inputValue($event)"
                             @clearInput="clearInput" @blur="blur()" :current-value.sync="addYwrStep.ywr.zjh"
                             className="input"></ehb-input-clear>
          </div>

          <div class="formItem">
            <button type="button" class="submit" @click="addYwr">添加</button>
          </div>
        </form>
      </div>
      <div v-if="current==6 && addInfoStep.showInfo">
        <div class="normal-box">
          <div class="normal-title"><span class="icon"></span><span class="text">不动产登记信息(单位：平方米)</span></div>
          <div class="normal-content">
            <div class="normal-row"><span class="col1">不动产证号 ：</span><span class="col2"></span>{{addInfoStep.info.fwxx.bdcqzh}}
            </div>
            <div class="normal-row"><span class="col1">房屋坐落：</span><span
              class="col2">{{addInfoStep.info.fwxx.fdzl}}</span></div>
            <div class="normal-row"><span class="col1">不动产单元号：</span><span
              class="col2">{{addInfoStep.info.fwxx.bdcdyh}}</span></div>
            <div class="normal-row"><span class="col1">土地使用权面积：</span><span
              class="col2">{{addInfoStep.info.fwxx.dytdmj}}</span></div>
            <div class="normal-row"><span class="col1">独用土地面积：</span><span
              class="col2">{{addInfoStep.info.fwxx.dytdmj}}</span></div>
            <div class="normal-row"><span class="col1">分摊土地面积：</span><span
              class="col2">{{addInfoStep.info.fwxx.fttdmj}}</span></div>
            <div class="normal-row"><span class="col1">房屋权利类型：</span><span
              class="col2">{{addInfoStep.info.fwxx.qllx}}</span></div>
            <div class="normal-row"><span class="col1">使用期限：</span><span
              class="col2">{{addInfoStep.info.fwxx.tdsyqx}}</span></div>
            <div class="normal-row"><span class="col1">起始时间：</span><span
              class="col2">{{addInfoStep.info.fwxx.tdsyqssj}}</span></div>
            <div class="normal-row"><span class="col1">截止时间：</span><span
              class="col2">{{addInfoStep.info.fwxx.tdsyjssj}}</span></div>
            <div class="normal-row"><span class="col1">规划用途：</span><span
              class="col2">{{addInfoStep.info.fwxx.ghyt}}</span></div>
            <div class="normal-row"><span class="col1">房屋建筑面积：</span><span
              class="col2">{{addInfoStep.info.fwxx.jzmj}}</span></div>
            <div class="normal-row"><span class="col1">房屋套内面积：</span><span
              class="col2">{{addInfoStep.info.fwxx.zyjzmj}}</span></div>
            <div class="normal-row"><span class="col1">房屋分摊面积：</span><span
              class="col2">{{addInfoStep.info.fwxx.ftjzmj}}</span></div>
          </div>
        </div>

        <div class="normal-box">
          <div class="normal-title"><span class="icon"></span><span class="text">卖方人信息</span></div>
          <div v-for="(qlr,i) in addInfoStep.info.qlrList">
            <div class="normal-content">
              <div class="normal-row"><span class="col1">姓名：</span><span class="col2">{{plusXing(qlr.qlrmc,0,1)}}</span>
              </div>
              <div class="normal-row"><span class="col1">证件种类：</span><span class="col2">{{GLOBAL.dicHandle.getName(qlr.zjzl,"zjzl")}}</span>
              </div>
              <div class="normal-row"><span class="col1">证件号：</span><span class="col2">{{plusXing(qlr.zjh,4,4)}}</span>
              </div>
              <div class="normal-row"><span class="col1">电话：</span><span class="col2">{{plusXing(qlr.dh,3,3)}}</span>
              </div>
            </div>
          </div>
        </div>

      </div>
      <div v-if="current==7">
        <form class="form">
          <div class="formItem">
            <div class="label">持有方式选择</div>
            <span class="input" @click="getGyfs()"><span style="width: 95%;">{{addGyfsStep.gyfs.name}}</span><img
              src="../../assets/img/pulldown.png"></span>
          </div>
        </form>
      </div>
      <div v-if="current==8">
        <div v-if="addBuyerStep.option.continueAdd">
          <div v-for="(buyer,i) in addBuyerStep.buyerList" @touchstart="touchStart(i)" @touchmove="touchMove"
               @touchend="touchEnd" style="user-select:none;">
            <div class="normal-content" v-if="buyer.applyUser =='1'">
              <div class="normal-row"><span class="col1">申请人姓名：</span><span
                class="col2">{{plusXing(buyer.qlrmc,0,1)}}</span></div>
              <div class="normal-row"><span class="col1">证件种类：</span><span class="col2">{{GLOBAL.dicHandle.getName(buyer.zjzl,"zjzl")}}</span>
              </div>
              <div class="normal-row"><span class="col1">申请人证件号：</span><span
                class="col2">{{plusXing(buyer.zjh,4,4)}}</span>
              </div>
              <div class="normal-row"><span class="col1">申请人电话：</span><span
                class="col2">{{plusXing(buyer.dh,3,3)}}</span></div>
            </div>
            <div class="normal-content" v-else>
              <div class="normal-row"><span class="col1">姓名：</span><span class="col2">{{buyer.qlrmc}}</span></div>
              <div class="normal-row"><span class="col1">证件种类：</span><span class="col2">{{GLOBAL.dicHandle.getName(buyer.zjzl,"zjzl")}}</span>
              </div>
              <div class="normal-row"><span class="col1">证件号：</span><span class="col2">{{buyer.zjh}}</span>
              </div>
              <div class="normal-row"><span class="col1">电话：</span><span class="col2">{{buyer.dh}}</span></div>
            </div>
          </div>
          <div style="color:red;width: 100%;text-align: center;" v-if="addBuyerStep.buyerList.length>0">
            (长按可删除买方,申请人不可删除)
          </div>
          <form class="form" v-if="addGyfsStep.gyfs.value!=0">
            <div class="formItem">
              <button type="button" class="submit" @click="continueAddBuyer">继续添加</button>
            </div>
          </form>
        </div>
        <form class="form" v-if="addBuyerStep.option.addBuyer">
          <div class="formItem">
            <div class="label">姓名<span style="color: red">&nbsp;*</span></div>
            <ehb-input-clear inputType="text" textName="姓名" placeholder="请输入姓名" @inputChanged="inputValue($event)"
                             @clearInput="clearInput" @blur="blur()" :current-value.sync="addBuyerStep.qlr.qlrmc"
                             className="input"></ehb-input-clear>
          </div>
          <div class="formItem">
            <div class="label">证件种类</div>
            <span class="input" @click="getZjzl()"><span style="width: 95%;">{{GLOBAL.dicHandle.getName(addBuyerStep.qlr.zjzl,"zjzl")}}</span><img
              src="../../assets/img/pulldown.png"></span>
          </div>
          <div class="formItem">
            <div class="label">证件号码<span style="color: red">&nbsp;*</span></div>
            <ehb-input-clear inputType="text" textName="证件号码" placeholder="请输入证件号码" @inputChanged="inputValue($event)"
                             @clearInput="clearInput" @blur="blur()" :current-value.sync="addBuyerStep.qlr.zjh"
                             className="input"></ehb-input-clear>
          </div>
          <div class="formItem">
            <div class="label">电话</div>
            <ehb-input-clear inputType="text" textName="电话" placeholder="请输入电话" @inputChanged="inputValue($event)"
                             @clearInput="clearInput" @blur="blur()" :current-value.sync="addBuyerStep.qlr.dh"
                             className="input"></ehb-input-clear>
          </div>
          <div class="formItem" v-if="addGyfsStep.gyfs.value==2">
            <div class="label">共有份额</div>
            <ehb-input-clear inputType="text" textName="额占比" placeholder="请输入份额占比，如0.5"
                             @inputChanged="inputValue($event)" @clearInput="clearInput" @blur="blur()"
                             :current-value.sync="addBuyerStep.qlr.gyfe" className="input"></ehb-input-clear>
          </div>
          <div class="formItem">
            <button type="button" class="submit" @click="addBuyer">添加</button>
          </div>
        </form>
      </div>
      <div v-if="current==9">
        <span style="color:red;width: 100%;text-align: left;font-size: 0.26rem;" @click="getFjAddress()">相关附件模板下载地址(点击复制链接)</span>
        <span style="color:red;width: 100%;text-align: left;font-size: 0.26rem;"
              @click="getFjAddress()">{{fjAddress}}</span>

        <form class="form">
          <div class="formItem" v-for="(fjlx,i) in addAttachmentStep.fjlxList">
            <div class="label">{{i+1}}. {{fjlx.fjlx}}<span style="color: red">&nbsp;*</span></div>
            <div class="upload-pad">
              <div v-for="(fjdz,j) in fjlx.fjdzList">
                <img class="uploadFile" v-bind:src="fjdz"
                     @click='deleteFile(fjdz,i,addAttachmentStep.fjlxList[i].fjlx)'><br/>
              </div>
              <span class="uploadBG" @click="getUploadFj(fjlx.fjlx+(fjlx.fjdzList.length+1),fjlx.fjlxid)"></span>
            </div>
          </div>
        </form>
      </div>
      <div v-if="current==10">
        <form class="form" v-for="(wxInfo,i) in wxStep.wxList">
          <div class="formItem">
            <div class="label">{{wxInfo.wxxx}}</div>
          </div>
          <div class="formItem">
            <RadioGroup v-model="wxInfo.result">
              <Radio label="是"></Radio>
              <Radio label="否"></Radio>
            </RadioGroup>
          </div>
        </form>
      </div>
      <div v-if="current==11">
        <div style="text-align: center;padding: 20% 5%;" v-html="applyResult"></div>
      </div>
    </ehb-multi-process>
    <ehb-footer :provider="jdxx.provider"></ehb-footer>
  </div>
</template>

<script>

  export default {
    name: "JiaJianMing",
    data() {
      return {
        userInfo: {},
        jdxx: {},
        isSubmit: false,
        current: 1,
        steps: ["办事指南", "阅读须知", "办理网点", "填写信息", "添加卖方", "确认信息", "持有方式", "添加买方", "添加附件", "询问记录", "提交成功"],
        text: {
          workGuide: "",
          readingNote: ""
        },
        djxx: {},
        addInfoStep: {
          showInfo: false,
          bdcqzh: "",
          info: {fwxx: {}, qlrList: []},
          hasAddApplyer: false,
          bdch: {
            date: "",
            city: "",
            xh: ""
          },
          zslx: "1"

        },
        addBlwdStep: {
          blwd: {
            name: "请选择办理网点",
            jdid: ""
          },
          isGray: true,
          blwdList: []
        },
        addGyfsStep: {
          isGray: true,
          gyfs: {
            name: "单独所有",
            value: "0"
          },
          gyfsNames: ["单独所有", "共同共有", "按份共有"]
        },
        addBuyerStep: {
          isGray: true,
          zjzlNames: ["身份证"],
          option: {
            addBuyer: true,
            continueAdd: false,
            timeOutEvent: 0
          },
          buyerList: [],
          qlr: {qlrmc: "", zjzl: "1", zjh: "", dh: "", gyfe: "", qlrlx: "1", qlrxz: "1"}
        },
        addAttachmentStep: {
          fjlxList: []
        },
        wxStep: {
          wxList: []
        },
        applyResult: "",
        sysLog: {
          id: "",
          operatetype: "",
          operateinfo: "",
          username: "",
          usercard: "",
          mobilephone: "",
          gnid: ""
        },
        fjAddress: "http://wl.ezrerc.com/hlwyy/Dmain.aspx?cxfs=BSZN",
        addYwrStep: {
          isGray: true,
          option: {
            addYwr: true,
            continueAdd: false,
            timeOutEvent: 0
          },
          ywrList: [],
          ywr: {mc: "", zjh: ""}
        },

      }
    },
    mounted() {
      let that = this;
      let pastYear = new Date().getFullYear();
      that.addInfoStep.bdch.date = pastYear;

      try{
        this.getTicket();
      }catch (e) {
        alert(e);
      }


      ehbAppJssdk.user.getUserInfo({
        success: function (res) {
          that.userInfo = res;

        }
      });
      ehbAppJssdk.operateWindow.getPrePageParams({
        success: function (res) {
          that.jdxx = JSON.parse(res);

          if (that.jdxx.currentStep) {
            that.jumpStep();
          } else {
            ehbAppJssdk.network.request({
              url: that.GLOBAL.urlConfig.getMyApplication[that.GLOBAL.urlType],
              method: 'post',
              data: {'zjh': that.userInfo.idCards, 'jdid': that.jdxx.id},
              headers: {'contentType': 'application/x-www-form-urlencoded'},
              success: function (res) {
                if (res && res.status == 0) {
                  if (res.result && res.result.length > 0) {

                    let zt = false;
                    for (let i in res.result) {
                      let data = res.result[i];
                      if (data.ywlxdm == "005") {
                        if (data.qqzt == 1 || data.qqzt == -1) {
                          zt = true;
                        }
                      }

                    }

                    if (zt) {
                      ehbAppJssdk.notice.confirm({
                        title: '提示',
                        message: '你有未办理的完成的业务，是否前往查看办理？',
                        buttonLabels: ['取消', '继续办理'],
                        success: function (res) {
                          let status = JSON.parse(res);
                          if (status.buttonIndex == 1) {

                            let params = {};
                            let url = absoultPath + "/onlineProcessing/MyApplication";
                            Object.assign(params, that.jdxx);
                            ehbAppJssdk.operateWindow.open({
                              title: '',
                              url: url,
                              urlType: 'webPage',
                              backRefresh: '1',
                              reloadForLogin: '1',
                              closeCurrentPage: '1',
                              disableScrolling: 'disable',
                              params: params,
                              pageType: '1',
                              pageLevel: '2',
                            });
                          } else {
                            that.getWorkGuid();
                          }

                        }
                      })
                    }
                  }
                }
              }
            });
          }
        }
      });

      this.getWorkGuid();
    },
    methods: {
      /**
       * 跳转到指定步骤!
       */
      jumpStep() {
        let currentStep = this.jdxx.currentStep;
        if (currentStep > 1) {
          this.getWorkGuid();
          this.getReadingNote()
        }
        if (currentStep > 2) {
          this.getApplyInfo();
        }
        if (currentStep > 7) {
          this.getAttachmentType();
          this.getFJList();
        }
        this.current = currentStep;
      },
      /**
       * 查询申请信息
       */
      getApplyInfo() {
        let that = this;
        this.sendRequest(this.GLOBAL.urlConfig.getApplyInfo[this.GLOBAL.urlType], {
          "sqbsid": this.jdxx.sqbsid
        }, "未查询到申请信息", function (data) {
          that.addBlwdStep.blwd.jdid = data.djxx.jdid;
          that.addBlwdStep.blwd.name = data.djxx.jdmc;
          that.addBlwdStep.isGray = false;
          if (that.jdxx.currentStep > 3) {
            that.addInfoStep.bdcqzh = data.djxx.bdcqzh;
            let str = data.djxx.bdcqzh;

            if (str) {
              that.addInfoStep.bdch.date = str.substring(str.indexOf("鄂(") + 2, 6);
              that.addInfoStep.bdch.city = str.substring(str.indexOf(")") + 1, str.indexOf("不动产权第"));
              that.addInfoStep.bdch.xh = str.substring(str.indexOf("不动产权第") + 5, str.indexOf("号"));
            }
          }
          if (that.jdxx.currentStep > 4) {
            that.djxx = data.djxx;
            that.addInfoStep.info.fwxx = data.djxx;
            that.addInfoStep.showInfo = true;
            if (data.qlrList) {
              for (let i in data.qlrList) {
                let qlr = data.qlrList[i];
                if (qlr.qlrxz == 2) {
                  that.addInfoStep.info.qlrList.push(qlr);
                } else if (qlr.qlrxz == 1) {
                  that.addBuyerStep.buyerList.push(qlr);
                  that.hasAddApplyer = true;
                }
              }
            }
          }
          if (that.jdxx.currentStep > 5) {
            if (data.djxx.gyfs) {
              that.addGyfsStep.gyfs.value = data.djxx.gyfs;
              that.addGyfsStep.gyfs.name = that.addGyfsStep.gyfsNames[data.djxx.gyfs];
            }
          }
          if (that.jdxx.currentStep > 6) {
            that.initAddBuyer();
          }
        });
      },
      /**
       * 根据申请标识id查询附件
       */
      getFJList() {
        let that = this;
        this.sendRequest(this.GLOBAL.urlConfig.getFJListBySqbsid[this.GLOBAL.urlType], {
          "sqbsid": this.jdxx.sqbsid
        }, "未查询到附件信息", function (data) {
          let fjlxList = that.addAttachmentStep.fjlxList;
          if (data && data.length > 0 && fjlxList && fjlxList.length > 0) {
            for (let j in data) {
              let fj = data[j];
              for (let i in fjlxList) {
                let fjlx = fjlxList[i];
                if (fjlx.fjlxid == fj.fjlxid) {
                  let fjdzList = fjlx.fjdzList;
                  if (!fjdzList) {
                    fjdzList = [];
                    fjlx.fjdzList = fjdzList;
                  }
                  fjdzList.push(that.GLOBAL.urlConfig.getFj[that.GLOBAL.urlType] + "?fjId=" + fj.id);
                  that.$set(that.addAttachmentStep.fjlxList, j, that.addAttachmentStep.fjlxList[j]);
                  break;
                }
              }
            }
          }
        });
      },
      nextClick() {
        switch (this.current) {
          case 2:
            this.getReadingNote();

            break;
          case 3:
            break;
          case 4:
            this.checkBlwd();
            break;
          case 5:
            this.getInfoByBdcqzh();
            break;
          case 6:
            this.getVerifyByMcAndZjh();
            break;
          case 7:
            this.saveApplyInfo();
            break;
          case 8:
            this.initAddBuyer();
            break;
          case 9:
            this.continueSaveApplyInfo();
            this.getAttachmentType();
            break;
          case 10:
            this.checkUploadFj();
            this.getWx();
            break;
          case 11:
            this.submitInfo();
            break;
        }
      },
      /**
       * 获取办事指南
       */
      getWorkGuid() {
        let that = this;
        this.sendRequest(this.GLOBAL.urlConfig.queryArticle[this.GLOBAL.urlType], {
          "jdid": this.jdxx.id,
          "typeCode": "0402",
          "ywlxbm": "005"
        }, "未查询到办事指南", function (data) {
          that.text.workGuide = data[0].content;
        })
      },
      /**
       * 获取阅读须知
       */
      getReadingNote() {
        let that = this;
        this.sendRequest(this.GLOBAL.urlConfig.queryArticle[this.GLOBAL.urlType], {
          "jdid": this.jdxx.id,
          "typeCode": "0401"
        }, "未查询到阅读须知", function (data) {
          that.text.readingNote = data[0].content;
        })
      },
      /**
       * 获取办理网点
       */
      getBlwd() {
        let that = this;
        this.sendRequest(this.GLOBAL.urlConfig.getJdByPid[this.GLOBAL.urlType], {
          "pid": this.jdxx.id
        }, "未查询到办理网点", function (data) {
          if (data && data.length > 0) {
            that.addBlwdStep.blwdList = [];
            let names = [];
            for (let i in data) {
              that.addBlwdStep.blwdList.push(data[i])
              names.push(data[i].jdmc);
            }
            ehbAppJssdk.notice.actionSheet({
              title: "办理网点",
              cancelButton: '取消',
              otherButtons: names,
              success: function (res) {
                let resJson = JSON.parse(res);
                if (resJson.buttonName != "取消") {
                  that.addBlwdStep.blwd.jdid = that.addBlwdStep.blwdList[resJson.buttonIndex].id;
                  /*that.addBlwdStep.blwd.jdid = "EF72039FA1414B7CBAD57FB3C9C879CB";*/
                  that.addBlwdStep.blwd.name = resJson.buttonName;
                  that.addBlwdStep.isGray = false;
                }
              }
            });
          }
        })

      },
      /**
       * 检查办理网点
       */
      checkBlwd() {

        if (this.isEmptyStr(this.addBlwdStep.blwd.jdid)) {
          ehbAppJssdk.notice.alert({
            title: '提示',
            message: '请先选择办理网点',
            buttonName: '收到',
          })
          this.current = 3;
        }

      },

      /**
       * 根据不动产权证号获取信息
       */
      getInfoByBdcqzh() {
        let that = this;
        if (that.addInfoStep.zslx == '1') {
          if (this.isEmptyStr(this.addInfoStep.bdch.date)) {
            ehbAppJssdk.notice.alert({
              title: '提示',
              message: '请输入所属年限',
              buttonName: '收到',
            })
            this.current--;
            return;
          }
          if (this.isEmptyStr(this.addInfoStep.bdch.city)) {
            ehbAppJssdk.notice.alert({
              title: '提示',
              message: '请输入所属市县',
              buttonName: '收到',
            })
            this.current--;
            return;
          }
          if (this.isEmptyStr(this.addInfoStep.bdch.xh)) {
            ehbAppJssdk.notice.alert({
              title: '提示',
              message: '请输入不动产证号',
              buttonName: '收到',
            })
            this.current--;
            return;
          }
          this.addInfoStep.bdcqzh = "鄂(" + this.addInfoStep.bdch.date + ")" + this.addInfoStep.bdch.city + "不动产权第" + this.addInfoStep.bdch.xh + "号";
        }

        if (this.isEmptyStr(this.addInfoStep.bdcqzh)) {
          ehbAppJssdk.notice.alert({
            title: '提示',
            message: '请输入不动产证号',
            buttonName: '收到',
          })
          this.current--;
          return;
        }
        /* ehbAppJssdk.notice.showPreloader({text: "正在查询中.."});
         this.sendRequest(this.GLOBAL.urlConfig.queryFWInfo[this.GLOBAL.urlType], {
             "jdid": this.addBlwdStep.blwd.jdid,
             "bdcqzh": this.addInfoStep.bdcqzh.trim()
         }, "未查询到房产信息", function (data) {
             ehbAppJssdk.notice.hidePreloader();
             if (!data || !data.fwxx || data.qlrList.length == 0) {
                 ehbAppJssdk.notice.alert({
                     title: '提示',
                     message: '未查询到该不动产证号信息，请确认后重新输入',
                     buttonName: '收到',
                 })

                 that.current--;
                 return;
             }
             that.addInfoStep.info = data;
             that.addInfoStep.showInfo = true;

         });*/


      },
      getVerifyByMcAndZjh() {
        let that = this;
        if (this.addYwrStep.ywrList.length == 0) {
          ehbAppJssdk.notice.alert({
            title: '提示',
            message: '未添加卖方人信息，请确认后重新输入',
            buttonName: '收到',
          })

          this.current--;
          return;
        }
        // alert(JSON.stringify(this.addYwrStep.ywrList))
        /*ehbAppJssdk.notice.showPreloader({text: "正在查询中.."});
        this.sendRequest(this.GLOBAL.urlConfig.queryFWInfo[this.GLOBAL.urlType], {
          "jdid": this.addBlwdStep.blwd.jdid,
          "bdcqzh": this.addInfoStep.bdcqzh.trim()
          //"htbh": JSON.stringify(this.addYwrStep.ywrList)
        }, "未查询到房产信息", function (data) {
          ehbAppJssdk.notice.hidePreloader();
          if (!data || !data.fwxx || data.qlrList.length == 0) {
            ehbAppJssdk.notice.alert({
              title: '提示',
              message: '未查询到该不动产证号和卖方信息，请确认后重新输入',
              buttonName: '收到',
            })

            that.current--;
            return;
          }
          that.addInfoStep.info = data;
          that.addInfoStep.showInfo = true;

        });*/
        let url = 'http://10.0.0.4:8089/nres/businessquery/getBDCInfo?nodeName=鄂州&version=1.0&t=1&ticket='
        ehbAppJssdk.network.request({
          url: '',
          method: 'post',
          data: data,
          headers: {'contentType': 'application/x-www-form-urlencoded'},
          success: function (res) {
            ehbAppJssdk.notice.hidePreloader();
            if (res.status == 0) {
              callback(res.result);
            } else {
              alert(JSON.stringify(res));
              that.toNOData(info, 0);
              that.current--;
            }
          },
          fail: function (res) {
            alert(JSON.stringify(res));
            that.toNOData(info, 0);
            that.current--;
            ehbAppJssdk.notice.hidePreloader();
          }
        });
      },
      /**
       * 获取nres票据
       */
      getTicket(){
        let url = 'http://10.0.0.4:8089/nres/base/test/getTicket?appId=B20200925160420AC39CC9F&appKey=E8905C136BE54A9AAC50B9C9686A40E9'
        ehbAppJssdk.network.request({
          url: url,
          method: 'post',
          data: {},
          headers: {'contentType': 'application/x-www-form-urlencoded'},
          success: function (res) {
            alert(JSON.stringify(res));
          },
          fail: function (res) {
            alert(JSON.stringify(res));
          }
        });
      },
      /**
       *  保存申请信息
       */
      saveApplyInfo() {
        let that = this;
        let qlrList = this.addInfoStep.info.qlrList;
        let isSaler = false;

        Object.assign(this.djxx, this.addInfoStep.info.fwxx);
        this.djxx.jdid = this.addBlwdStep.blwd.jdid;
        this.djxx.jdmc = this.addBlwdStep.blwd.name;
        this.djxx.ywlxdm = "005";
        this.djxx.ywlxmc = this.jdxx.ywlxmc;
        this.djxx.currentStep = this.current;

        if (qlrList) {
          for (let i in qlrList) {
            qlrList[i].qlrlx = "1";
            qlrList[i].qlrxz = "2";
            if (!isSaler) {
              if (qlrList[i].zjh == this.userInfo.idCards) {
                isSaler = true;
                qlrList[i].applyUser = "1";
              }
            }
          }
        }

        let qlrList2 = this.copyDeep(qlrList);

        if (!isSaler) {
          let qlr = {
            "qlrmc": this.userInfo.names,
            "zjh": this.userInfo.idCards,
            "dh": this.userInfo.mobilePhone,
            "zjzl": "1",
            "qlrlx": "1",
            "qlrxz": "1",
            "applyUser": "1"
          };
          qlrList2.push(qlr);
          if (!this.hasAddApplyer) {
            this.addBuyerStep.buyerList.push(qlr);
            this.hasAddApplyer = true;
          }
        }
        this.sendRequest(this.GLOBAL.urlConfig.saveApplyInfo[this.GLOBAL.urlType], {
          "qlrList": JSON.stringify(qlrList2),
          "djxx": JSON.stringify(this.djxx)
        }, "保存申请信息失败!", function (data) {
          that.djxx.id = data.id;
        })

      },
      /**
       * 获取共有方式
       */
      getGyfs() {
        let that = this;
        let names = this.addGyfsStep.gyfsNames;
        ehbAppJssdk.notice.actionSheet({
          title: "共有方式",
          cancelButton: '取消',
          otherButtons: names,
          success: function (res) {
            let resJson = JSON.parse(res);
            if (resJson.buttonName != "取消") {
              that.addGyfsStep.gyfs.value = resJson.buttonIndex;
              that.addGyfsStep.gyfs.name = resJson.buttonName;
            }
          }
        });
      },
      /**
       * 初始化添加买方
       */
      initAddBuyer() {
        this.addBuyerStep.option.addBuyer = this.addBuyerStep.buyerList.length == 0;
        this.addBuyerStep.option.continueAdd = this.addBuyerStep.buyerList.length > 0;
      },
      /**
       * 添加买方
       */
      addBuyer() {
        let buyer = JSON.parse(JSON.stringify(this.addBuyerStep.qlr));
        if (this.isEmptyStr(buyer.qlrmc)) {
          ehbAppJssdk.notice.alert({
            title: '提示',
            message: '姓名不能为空',
            buttonName: '收到',
          });
          return;
        }
        if (this.isEmptyStr(buyer.zjh)) {
          ehbAppJssdk.notice.alert({
            title: '提示',
            message: '证件号不能为空',
            buttonName: '收到',
          });
          return;
        }
        /* if (!this.IdentityCodeValid(buyer.zjh)) {
             ehbAppJssdk.notice.alert({
                 title: '提示',
                 message: '证件号码不正确',
                 buttonName: '收到',
             });
             return;
         }*/
        if (!this.isEmptyStr(buyer.dh)) {
          if (!this.isMobile(buyer.dh)) {
            ehbAppJssdk.notice.alert({
              title: '提示',
              message: '手机号错误',
              buttonName: '收到',
            });
            return;
          }
        }
        this.addBuyerStep.qlr = {qlrmc: "", zjzl: "1", zjh: "", dh: "", gyfe: "", qlrlx: "1", qlrxz: "1"};
        this.addBuyerStep.buyerList.push(buyer);
        this.addBuyerStep.option.addBuyer = false;
        this.addBuyerStep.option.continueAdd = true;

      },
      /**
       * 添加义务人（卖方）
       */
      addYwr() {
        let ywr = JSON.parse(JSON.stringify(this.addYwrStep.ywr));
        if (this.isEmptyStr(ywr.mc)) {
          ehbAppJssdk.notice.alert({
            title: '提示',
            message: '名称不能为空',
            buttonName: '收到',
          });
          return;
        }
        if (this.isEmptyStr(ywr.zjh)) {
          ehbAppJssdk.notice.alert({
            title: '提示',
            message: '证件号不能为空',
            buttonName: '收到',
          });
          return;
        }
        /* if (!this.IdentityCodeValid(ywr.zjh)) {
             ehbAppJssdk.notice.alert({
                 title: '提示',
                 message: '证件号码不正确',
                 buttonName: '收到',
             });
             return;
         }*/

        this.addYwrStep.ywr = {mc: "", zjh: ""};
        this.addYwrStep.ywrList.push(ywr);
        this.addYwrStep.option.addYwr = false;
        this.addYwrStep.option.continueAdd = true;

      },
      /**
       * 获取证件种类
       */
      getZjzl() {
        let that = this;
        let names = this.addBuyerStep.zjzlNames;
        ehbAppJssdk.notice.actionSheet({
          title: "证件种类",
          cancelButton: '取消',
          otherButtons: names,
          success: function (res) {
            let resJson = JSON.parse(res);
            if (resJson.buttonName != "取消") {
              that.addBuyerStep.qlr.zjzl = resJson.buttonIndex + 1;
            }
          }
        });
      },
      /**
       * 继续添加买方
       */
      continueAddBuyer() {
        this.addBuyerStep.option.addBuyer = true;
        this.addBuyerStep.option.continueAdd = false;
      },
      /**
       * 继续添加卖方
       */
      continueAddYwr() {
        this.addYwrStep.option.addYwr = true;
        this.addYwrStep.option.continueAdd = false;
      },
      /**
       * 继续保存申请信息
       */
      continueSaveApplyInfo() {
        this.djxx.gyfs = this.addGyfsStep.gyfs.value;
        if (this.djxx.gyfs == "1") {
          //共同共有
          if (this.addBuyerStep.buyerList && this.addBuyerStep.buyerList.length > 0) {
            for (let i in this.addBuyerStep.buyerList) {
              let buyer = this.addBuyerStep.buyerList[i];
              buyer.gyfe = (1 / this.addBuyerStep.buyerList.length).toFixed(4) * 100 + "%";
            }
          }
        }

        let qlrList = [];
        qlrList = this.addInfoStep.info.qlrList.concat(this.addBuyerStep.buyerList);

        let that = this;
        this.djxx.currentStep = this.current;
        //保存申请信息
        this.sendRequest(this.GLOBAL.urlConfig.saveApplyInfo[this.GLOBAL.urlType], {
          "qlrList": JSON.stringify(qlrList),
          "djxx": JSON.stringify(this.djxx)
        }, "保存申请信息失败!", function (data) {
          that.djxx.id = data.id;
        });
      },
      /**
       * 获取附件类型
       */
      getAttachmentType() {
        let that = this;
        this.sendRequest(this.GLOBAL.urlConfig.getFJLX[this.GLOBAL.urlType], {
          "jdid": this.jdxx.id,
          "ywlxbm": "005"
        }, "未查询到附件类型", function (data) {
          that.addAttachmentStep.fjlxList = data;
          if (that.addAttachmentStep.fjlxList) {
            for (let i in that.addAttachmentStep.fjlxList) {
              that.addAttachmentStep.fjlxList[i].fjdzList = [];
            }
          }
        });
      },
      /**
       *  上传附件
       */
      uploadAttachment(fileName, fjlxid) {
        let that = this;
        let sqbsid = this.djxx.id;

        ehbAppJssdk.media.photoAlbum({
          url: this.GLOBAL.urlConfig.uploadFile[this.GLOBAL.urlType],
          clipPicture: '2',
          sqbsid: sqbsid,
          fileName: fileName,
          fjlxid: fjlxid,
          success: function (res) {
            let resJO = JSON.parse(res);
            if (resJO.status == 0) {
              let fjlxList = that.addAttachmentStep.fjlxList;
              if (fjlxList) {
                for (let i in fjlxList) {
                  let fjlx = fjlxList[i];
                  if (fjlx.fjlxid == fjlxid) {
                    let fjdzList = fjlx.fjdzList;
                    if (!fjdzList) {
                      fjdzList = [];
                      fjlx.fjdzList = fjdzList;
                    }
                    fjdzList.push(that.GLOBAL.urlConfig.getFj[that.GLOBAL.urlType] + "?fjId=" + resJO.result);
                    that.$set(that.addAttachmentStep.fjlxList, i, that.addAttachmentStep.fjlxList[i]);
                    break;
                  }
                }
              }
            }
          }
        })
      },
      /**
       *  上传拍照附件
       */
      uploadPhotoAttachment(fileName, fjlxid) {

        let that = this;
        let sqbsid = this.djxx.id;
        ehbAppJssdk.media.takePhoto({
          url: this.GLOBAL.urlConfig.uploadFile[this.GLOBAL.urlType],
          cameraType: 'cameraRear',
          clipPicture: '2',
          sqbsid: sqbsid,
          fileName: fileName,
          fjlxid: fjlxid,
          success: function (res) {

            let resJO = JSON.parse(res);
            if (resJO.status == 0) {
              let fjlxList = that.addAttachmentStep.fjlxList;
              if (fjlxList) {
                for (let i in fjlxList) {
                  let fjlx = fjlxList[i];
                  if (fjlx.fjlxid == fjlxid) {
                    let fjdzList = fjlx.fjdzList;
                    if (!fjdzList) {
                      fjdzList = [];
                      fjlx.fjdzList = fjdzList;
                    }
                    fjdzList.push(that.GLOBAL.urlConfig.getFj[that.GLOBAL.urlType] + "?fjId=" + resJO.result);
                    that.$set(that.addAttachmentStep.fjlxList, i, that.addAttachmentStep.fjlxList[i]);
                    break;
                  }
                }
              }
            }
          }
        })
      },
      /**
       * 获取上传附件方式
       */
      getUploadFj(fileName, fjlxid) {

        let that = this;

        ehbAppJssdk.notice.actionSheet({
          title: "上传附件方式",
          cancelButton: '取消',
          otherButtons: ["从本地相册选择", "拍一张照片"],
          success: function (res) {
            let resJson = JSON.parse(res);
            if (resJson.buttonIndex == 0) {
              that.uploadAttachment(fileName, fjlxid);
            }
            if (resJson.buttonIndex == 1) {
              that.uploadPhotoAttachment(fileName, fjlxid);
            }

          }
        });
      },
      /**
       * 检查上传附件
       */
      checkUploadFj() {
        let check = true;
        if (this.addAttachmentStep.fjlxList) {

          for (let i in this.addAttachmentStep.fjlxList) {
            let fjdz = this.addAttachmentStep.fjlxList[i].fjdzList;
            if (fjdz.length > 0) {

            } else {
              check = false;
              break;
            }
          }
        }

        if (!check) {
          ehbAppJssdk.notice.alert({
            title: '提示',
            message: '请先上传附件',
            buttonName: '收到',
          })
          this.current = 8;
          return;
        }

      },
      /**
       *  添加问询
       */
      getWx() {

        let that = this;
        this.sendRequest(this.GLOBAL.urlConfig.getWx[this.GLOBAL.urlType], {
          "jdId": this.jdxx.id,
        }, "无查询问询信息", function (data) {
          that.wxStep.wxList = data;
          if (that.wxStep.wxList != null) {
            for (let i in that.wxStep.wxList) {
              that.wxStep.wxList[i].result = "否";
            }
          }
        });
      },
      /**
       *  提交信息
       */
      submitInfo() {
        let that = this;
        let pass = true;
        if (this.wxStep.wxList) {
          for (let i in this.wxStep.wxList) {
            let wxInfo = this.wxStep.wxList[i];
            if (wxInfo.result == "否") {
              pass = false;
              break;
            }
          }
        }
        if (!pass) {
          ehbAppJssdk.notice.alert({
            title: '提示',
            message: '请您先同意问询！',
            buttonName: '收到',
          })
          this.current--;
          return;
        }
        // //人脸识别，通过才能申请
        ehbAppJssdk.user.AliFaceCompar({
          name: this.userInfo.names,
          idCard: this.userInfo.idCards,
          success: function (res) {
            let data = JSON.parse(res);
            if (data.resultStatus == "9000") {
              //提交申请
              that.isSubmit = true;
              ehbAppJssdk.notice.showPreloader({text: "正在申请中.."});
              that.sendRequest(that.GLOBAL.urlConfig.apply[that.GLOBAL.urlType], {
                "sqbsid": that.djxx.id
              }, "申请失败!", function (data) {
                if (data) {
                  that.applyResult = "<p>恭喜您已经申请成功！</p><p>您的申请编号为：" + data + "。</p><p>您的申请已经完成，我们将会在3个工作日内给您答复。</p>";
                } else {
                  that.steps[that.steps.length - 1] = "提交失败";
                  that.applyResult = "您的申请信息提交失败，请稍后重试！";
                }
              })
            } else {
              ehbAppJssdk.notice.alert({
                title: '提示',
                message: '您没有通过人脸识别认证，请重新提交信息！',
                buttonName: '收到',
              });
              that.current--;
            }
          }
        });
      },
      /**
       *  完成
       */
      complete() {
        ehbAppJssdk.operateWindow.goBack({
          index: '1'
        })
      },
      touchStart(index) {
        let that = this;
        clearTimeout(this.addBuyerStep.option.timeOutEvent);//清除定时器
        this.addBuyerStep.option.timeOutEvent = 0;
        this.addBuyerStep.option.timeOutEvent = setTimeout(function () {
          if (that.addBuyerStep.buyerList[index]["applyUser"]) {
            ehbAppJssdk.notice.alert({
              title: '提示',
              message: '申请人不可以删除',
              buttonName: '收到',
              success: function () {
              }
            });
            return;
          }
          //执行长按要执行的内容，
          ehbAppJssdk.notice.confirm({
            title: '提示',
            message: '是否确定删除该买方',
            buttonLabels: ['取消', '确定'],
            success: function (res) {
              let resJson = JSON.parse(res);
              if (resJson.buttonIndex == 1) {
                that.addBuyerStep.buyerList.splice(index, 1);
              }
            }
          })
        }, 600);//这里设置定时
      },
      touchMove() {
        clearTimeout(this.addBuyerStep.option.timeOutEvent);
      },
      touchEnd() {
        clearTimeout(this.addBuyerStep.option.timeOutEvent);
      },
      touchYwrStart(index) {
        let that = this;
        clearTimeout(this.addYwrStep.option.timeOutEvent);//清除定时器
        this.addYwrStep.option.timeOutEvent = 0;
        this.addYwrStep.option.timeOutEvent = setTimeout(function () {
          //执行长按要执行的内容，
          ehbAppJssdk.notice.confirm({
            title: '提示',
            message: '是否确定删除该卖方',
            buttonLabels: ['取消', '确定'],
            success: function (res) {
              let resJson = JSON.parse(res);
              if (resJson.buttonIndex == 1) {
                that.addYwrStep.ywrList.splice(index, 1);
              }
            }
          })
        }, 600);//这里设置定时
      },
      touchYwrMove() {
        clearTimeout(this.addYwrStep.option.timeOutEvent);
      },
      touchYwrEnd() {
        clearTimeout(this.addYwrStep.option.timeOutEvent);
      },
      deleteFile(url, num, fjlx) {
        let fjId = url.split('fjId=')[1];
        let that = this;
        ehbAppJssdk.notice.contentPopup({
          title: fjlx,
          img: url,
          width: '500',
          height: '720',
          buttonName: '删除附件',
          success: function (res) {
            let resJson1 = JSON.parse(res);
            if (resJson1.code == 1) {
              ehbAppJssdk.notice.confirm({
                title: '提示',
                message: '是否确定删除附件照片',
                buttonLabels: ['取消', '确定'],
                success: function (res) {
                  let resJson = JSON.parse(res);
                  if (resJson.buttonIndex == 1) {
                    for (let i = 0; i < that.addAttachmentStep.fjlxList.length; i++) {
                      if (i == num) {
                        that.addAttachmentStep.fjlxList[i].fjdzList;
                        for (let j = 0; j < that.addAttachmentStep.fjlxList[i].fjdzList.length; j++) {
                          if (url == that.addAttachmentStep.fjlxList[i].fjdzList[j]) {
                            that.addAttachmentStep.fjlxList[i].fjdzList.splice(j, 1);
                            that.$set(that.addAttachmentStep.fjlxList, i, that.addAttachmentStep.fjlxList[i]);
                          }
                        }
                      }
                    }
                    //调用后台删除附件
                    // that.sendRequest(that.GLOBAL.urlConfig.deleteFJbyFjId[that.GLOBAL.urlType], {
                    //   "fjId": fjId
                    // }, "删除失败", function (data) {
                    // });
                  }
                }
              });
            }
          }
        })
      },
      /**
       * 发送请求
       * @param data
       * @param info
       * @returns {string}
       */
      sendRequest(url, data, info, callback) {
        let that = this;
        ehbAppJssdk.network.request({
          url: url,
          method: 'post',
          data: data,
          headers: {'contentType': 'application/x-www-form-urlencoded'},
          success: function (res) {
            ehbAppJssdk.notice.hidePreloader();
            if (res.status == 0) {
              callback(res.result);
            } else {
              that.toNOData(info, 0);
              that.current--;
            }
          },
          fail: function (res) {
            that.toNOData(info, 0);
            that.current--;
            ehbAppJssdk.notice.hidePreloader();
          }
        });
      },
      blur() {
        document.body.scrollTop = document.documentElement.scrollTop = 0;
      },
      /**
       * 获取当前日期
       */
      getDate() {
        let that = this;
        ehbAppJssdk.notice.datePicker({
          title: "选择年限",
          columnsType: '1',
          minDate: '1900',
          maxDate: '3029',
          success: function (res) {
            let resJson = JSON.parse(res);
            that.addInfoStep.bdch.date = resJson.year;

          }
        })
      },
      /**
       * 获取附件地址
       */
      getFjAddress() {
        let txt = this.fjAddress;
        ehbAppJssdk.device.copyText({
          text: txt,
        })
      }
    }
  }
</script>

<style scoped>
  .normal-box {
    margin-bottom: 0.4rem;
  }

  .normal-title .icon {
    width: 0.1rem;
    height: 0.34rem;
    background: rgba(61, 117, 197, 1);
    display: inline-block;
    vertical-align: middle;
  }

  .normal-title .text {
    width: 6.20rem;
    height: 0.4rem;
    font-size: 0.32rem;
    font-family: PingFangSC-Regular;
    font-weight: 400;
    color: rgba(39, 49, 64, 1);
    line-height: 0.4rem;
    margin-left: 0.2rem;
    display: inline-block;
    vertical-align: middle;
  }

  .normal-content {
    padding: 0.2rem 0;
    border-bottom: #DDDDE0 solid 0.01rem;
  }

  .normal-content .normal-row {
    margin-top: 0.1rem;
    min-height: 0.32rem;
    font-size: 0.26rem;
    font-family: PingFangSC-Regular;
    font-weight: 400;
    color: rgba(165, 173, 185, 1);
    line-height: 0.32rem;
    display: flex;
  }

  .normal-content .normal-row .col1 {
    width: 2.1rem;
    font-family: PingFangSC-Medium;
    font-weight: 500;
    margin-right: 0.3rem;
    flex-shrink: 0;
  }

  .upload-pad {
    display: flex;
    flex-wrap: wrap;
  }

  .upload-pad .uploadFile {
    width: 1.58rem;
    height: 1.58rem;
    margin-right: 0.2rem;
  }

  .upload-pad .uploadBG {
    width: 1.58rem;
    height: 1.58rem;
    background-image: url(../../assets/img/camera.png);
    background-size: 100% 100%;
  }

  .city {
    width: 3.5rem;
    height: 0.86rem;
    background: rgba(249, 249, 251, 1);
    border-radius: 0.04rem;
    border: 0;
    outline: none;
    display: inline-block;
    line-height: 0.5rem;
    padding: 0.18rem 0.3rem;
    display: flex;
    align-items: center;
  }

  .divInput {
    width: 6.30rem;
    height: 0.86rem;
    background: rgba(249, 249, 251, 1);
    border-radius: 0.04rem;
    border: 0;
    outline: none;
    display: inline-block;
    line-height: 0.5rem;
    padding-left: 0.2rem;
    display: flex;
    align-items: center;

  }
</style>
